package top.waterduck.server.exception;

import top.waterduck.server.enums.BusinessExceptionCodeEnum;

/**
 * @author duck
 */
public class BusinessException  extends RuntimeException{

    private BusinessExceptionCodeEnum codeEnum;

    public BusinessException (BusinessExceptionCodeEnum code) {
        super(code.getDesc());
        this.codeEnum = code;
    }
    public BusinessExceptionCodeEnum getCodeEnum() {
        return codeEnum;
    }

    public void setCodeEnum(BusinessExceptionCodeEnum codeEnum) {
        this.codeEnum = codeEnum;
    }
    /**
     * 不写入堆栈信息，提高性能
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
